package com.enba.rbacadmin;

import com.enba.boot.generator.generator.AutoGeneratorHelper;
import javax.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan("com.enba.rbacadmin.module.**.mapper")
@Slf4j
public class RbacAdminApplication {

  public static void main(String[] args) {
    SpringApplication.run(RbacAdminApplication.class, args);
    log.info("服务启动成功");
  }

  @Autowired(required = false)
  private AutoGeneratorHelper autoGeneratorHelper;

  @PostConstruct
  public void generator() {
    // 代码自动生成
    if (autoGeneratorHelper != null) {
      autoGeneratorHelper.generator();
    }
  }
}
